package com.zyh.kaoshi.test3;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Author zyh
 * @Date 2024/8/10 11:29
 * @Description
 */

public class Test3 {
    public static void main(String[] args) {
        FileOutputStream fos =null;
        FileInputStream fis =null;
        try {
            fos = new FileOutputStream("day13-code/src/com/zyh/kaoshi/test3/test.txt",true);
            String s="Hello Word";
            fos.write(s.getBytes());
            fis = new FileInputStream("day13-code/src/com/zyh/kaoshi/test3/test.txt");
            byte[] car=new byte[1024];
            int len=-1;
            while ((len=fis.read(car))!=-1){
                System.out.println(new String(car,0,len));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fis.close();
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
